{% extends 'student_management/base.html' %}

{% block content %}
<div class="d-flex justify-content-between align-items-center mb-4">
    <h2>学生列表</h2>
    <a href="{% url 'student-create' %}" class="btn btn-primary">添加学生</a>
</div>

<table class="table table-striped">
    <thead>
        <tr>
            <th>学号</th>
            <th>姓名</th>
            <th>性别</th>
            <th>年级</th>
            <th>专业</th>
            <th>操作</th>
        </tr>
    </thead>
    <tbody>
        {% for student in students %}
        <tr>
            <td>{{ student.student_id }}</td>
            <td>{{ student.name }}</td>
            <td>{{ student.get_gender_display }}</td>
            <td>{{ student.grade }}</td>
            <td>{{ student.major }}</td>
            <td>
                <a href="{% url 'student-update' student.pk %}" class="btn btn-sm btn-warning">编辑</a>
                <a href="{% url 'student-delete' student.pk %}" class="btn btn-sm btn-danger">删除</a>
            </td>
        </tr>
        {% endfor %}
    </tbody>
</table>
{% endblock %} 